package com.songcha.module_main.ui.activity.main

import android.app.Application
import com.songcha.library_base.interfaces.IApiResult
import com.songcha.library_base.mvvm.base.BaseViewModel
import com.songcha.library_business.proxy.userinfo.UserInfoManager
import com.songcha.library_common.util.DeviceUtil
import com.songcha.library_network.bean.BaseBean
import com.songcha.library_network.bean.BaseStringDataBean
import org.json.JSONArray
import org.json.JSONObject

class MainViewModel(app:Application):BaseViewModel<MainRepository>(app) {

    fun loginByDeviceId(){
        handleApiDataObserver(repository.loginByDeviceId(DeviceUtil.getAndroidId(getApplication())),object:IApiResult<BaseStringDataBean>{
            override fun onSuccess(bean: BaseStringDataBean) {
                UserInfoManager.saveLogin(bean.data)
            }

            override fun onError(e: Throwable) {

            }

        })
    }



}